/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.max.oti.system.util.converter;

import com.max.oti.system.model.Modality;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.FacesConverter;
import org.omnifaces.converter.SelectItemsConverter;

/**
 *
 * @author Nigelito
 */
@FacesConverter("ModalityObject")
public class ModalityConverter extends SelectItemsConverter{
     @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        Integer id = (value instanceof Modality) ? ((Modality) value).getId() : null;
        return (id != null) ? String.valueOf(id) : null;
    }
}
